﻿/*
* 创建者：LIYINFAI
* 创建时间：2023/7/21 14:44:51
* 描述：
* --------------------------------------
* 修改说明：
* --------------------------------------
*/
using System;
using System.Drawing;
using System.Windows.Forms;

namespace CommonLibrary.Forms
{
    /// <summary>
    /// 启动窗口
    /// </summary>
    public partial class HWFrmSplash : Form
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public HWFrmSplash()
        {
            InitializeComponent();
            this.BackColor = ColorSettings.SplashFormBackColor;
            this.ShowInTaskbar = false;
            SetVersion();
        }
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Kill(object sender, EventArgs e)
        {
            this.Close();
            this.Cursor = Cursors.Default;
        }
        /// <summary>
        /// 前端显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void BringTop(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
        }
        /// <summary>
        /// 改变信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ChangeInfo(object sender, EventArgs e)
        {
            this.labelInfo.Text = sender as string;
        }
        /// <summary>
        /// 设置系统名字
        /// </summary>
        /// <param name="systemName"></param>
        public void SetSystemName(string systemName)
        {
            this.labelSystemName.Text = systemName;
        }
        /// <summary>
        /// 设置版本信息
        /// </summary>
        /// <param name="version"></param>
        public void SetVersion(string version="")
        {
            version = $"版本号：{(string.IsNullOrWhiteSpace(version)? PluginManager.Instance.Excute(PluginParam.Instance().GetPluginParam("App", "VERSION_VERSION")) : version)}"; 
            this.labelVersion.Text = version;
        }
        /// <summary>
        /// 设置图标
        /// </summary>
        /// <param name="logo"></param>
        public void SetLogo(Image logo)
        {
            this.labelEmptyTop.Image = logo;
            this.labelEmptyTop.Refresh();
        }
    }
}
